package String;

/**
 * @author wuhan
 * @date 2019/9/23 11:47
 */
public class StringDemo2 {
    public static void methodTransAndThan(){
        String s="    Hello Java";
        sop(s.toLowerCase());
        sop(s.toUpperCase());
        sop(s.trim());
    }









    public static void methodTrans(){
        char [] arr={'a','c','d','e','f','f'};
        String s=new String(arr,1,3);
        sop("s="+s);
        s.toCharArray();
        sop(s);
        String s1="Hello Java Nikon Canon,I love you";
        String s2=s1.replaceAll("Java", "word");
        sop(s2);
        String[] s3 = s1.split(" ");
        sop(s3[3]);
        try {
            sop(s1.substring(2,-1));
        } catch (StringIndexOutOfBoundsException e) {
            sop(" 发生异常");
            sop("越界了");
        }
        sop(s1.substring(2,4));



    }

    public static void main(String[] args) {
        methodTransAndThan();
    }
    public static  void sop(Object o){
        System.out.println(o);
    }
}
